package cn.hznc.domain.entity;


import cn.hznc.domain.entity.common.BaseEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 产品表
 */
@Getter
@Setter
@Table(name = "t_production")
@TableName(value = "t_production")
public class ProductionEntity extends BaseEntity {

    @Column(name = "id",type = MySqlTypeConstant.INT,length = 11,isKey = true,isAutoIncrement = true)
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 产品名称
     */
    @Column(name = "name", type = MySqlTypeConstant.VARCHAR, length = 200)
    private String name;

    /**
     * 产品类型-毛坯/成品
     * blank/finished
     */
    @Column(name = "type", type = MySqlTypeConstant.VARCHAR, length = 200)
    private String type;

    /**
     * 图号
     */
    @Column(name = "figure_no", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField(value = "figure_no")
    private String figureNo;

    /**
     * 物料编码
     */
    @Column(name = "material_no", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField(value = "material_no")
    private String materialNo;

    /**
     * 描述
     */
    @Column(name = "description", type = MySqlTypeConstant.VARCHAR, length = 200)
    private String description;

    /**
     * 重量
     */
    @Column(name = "heavy", type = MySqlTypeConstant.DECIMAL, length = 10)
    private BigDecimal heavy;

    /**
     * 产品类型
     */
    @Column(name = "production_num", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField(value = "production_num")
    private String productionNum;

    /**
     * 产品图片
     */
    @Column(name = "image", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField(value = "image")
    private String image;

    /**
     * 产品图片
     */
    @Column(name = "status", type = MySqlTypeConstant.TINYINT)
    @TableField(value = "status")
    private Integer status;

    /**
     * 产品图片
     */
    @Column(name = "production_bom_status", type = MySqlTypeConstant.TINYINT)
    @TableField(value = "production_bom_status")
    private Integer productionBomStatus;

    /**
     * 产品图片
     */
    @Column(name = "production_process_connect_status", type = MySqlTypeConstant.TINYINT)
    @TableField(value = "production_process_connect_status")
    private Integer productionProcessConnectStatus;

    /**
     * 产品图片
     */
    @Column(name = "process_status", type = MySqlTypeConstant.TINYINT)
    @TableField(value = "process_status")
    private Integer processStatus;

    /**
     * 产品图号冗余字段
     */
    @Column(name = "figure_no_reload",type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField(value = "figure_no_reload")
    private String figureNoReload;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ProductionEntity that = (ProductionEntity) o;

        return materialNo.equals(that.materialNo);
    }

    @Override
    public int hashCode() {
        return materialNo.hashCode();
    }
}
